#pragma once
#include "RTPDecoderHandle.hpp"
#include <functional>

class RTPSharePictureImpl;
namespace Hi {
class RTPSharePicture : public RTPDecoderHandle {
  public:
    using PIC_CALLBACK =
        std::function<void(const uint8_t *, uint32_t, uint32_t)>;

  public:
    RTPSharePicture();
    RTPSharePicture(const RTPSharePicture &) = delete; // forbid copy
    ~RTPSharePicture();

  public:
    bool Start(const char *sharePathPrefix, uint32_t width, uint32_t height);
    void Stop();

  public:
    void OnYUV(const uint8_t *data, size_t len, uint32_t width, uint32_t height,
               void *option);
    void OnRGB(const uint8_t *data, size_t len, uint32_t width, uint32_t height,
               void *option);
    void SetCallback(const PIC_CALLBACK &onrgb, const PIC_CALLBACK &onyuv);

  private:
    RTPSharePictureImpl *impl{nullptr};
    PIC_CALLBACK on_rbg;
    PIC_CALLBACK on_yuv;
};
} // namespace Hi